import Home from '@/views/Home.vue'
import Login from '@/views/account/Login.vue'

const Regist = () => import('@/views/account/Regist.vue')
const Forget = () => import('@/views/account/Forget.vue')

const StadiumIndex = () => import(/* webpackChunkName: "stadium" */ '@/views/stadium/Index.vue')
const StadiumHome = () => import(/* webpackChunkName: "stadium" */ '@/views/stadium/Home.vue')
const StadiumList = () => import(/* webpackChunkName: "stadiuminfo" */ '@/views/stadium/List.vue')
const StadiumDetail = () => import(/* webpackChunkName: "stadiuminfo" */ '@/views/stadium/Detail.vue')
const StadiumOrder = () => import(/* webpackChunkName: "stadiumbuy" */ '@/views/stadium/Order.vue')
const StadiumTicket = () => import(/* webpackChunkName: "stadiumbuy" */ '@/views/stadium/Ticket.vue')
const StadiumSearch = () => import(/* webpackChunkName: "stadiumsearch" */ '@/views/stadium/Search.vue')
const StadiumComment = () => import(/* webpackChunkName: "stadiumcomment */ '@/views/stadium/Comment.vue')

const AssociationList = () => import(/* webpackChunkName: "association" */ '@/views/association/list.vue')
const AssociationDetail = () => import(/* webpackChunkName: "association" */ '@/views/association/detail.vue')
const AssociationIndex = () => import(/* webpackChunkName: "association" */ '@/views/association/Index.vue')
const AssociationNews = () => import(/* webpackChunkName: "associationnews" */ '@/views/association/News.vue')
const AssociationNewsDetail = () => import(/* webpackChunkName: "associationnews" */ '@/views/association/NewsDetail.vue')

const FitIndex = () => import(/* webpackChunkName: "fit" */ '@/views/fit/Index.vue')
const FitMap = () => import(/* webpackChunkName: "fit" */ '@/views/fit/Map.vue')
const FitHome = () => import(/* webpackChunkName: "fit" */ '@/views/fit/Home.vue')

const NewsIndex = () => import(/* webpackChunkName: "news" */ '@/views/news/Index.vue')
// const NewsList = () => import(/* webpackChunkName: "news" */ '@/views/news/List.vue')
const NewsDetail = () => import(/* webpackChunkName: "news" */ '@/views/news/Detail.vue')

// const VoiceIndex = () => import(/* webpackChunkName: "voice" */ '@/views/voice/Index.vue')
// const VoiceList = () => import(/* webpackChunkName: "voice" */ '@/views/voice/List.vue')
// const VoiceForm = () => import(/* webpackChunkName: "voice" */ '@/views/voice/Form.vue')
// const VoiceDetail = () => import(/* webpackChunkName: "voice" */ '@/views/voice/Detail.vue')

const UserIndex = () => import(/* webpackChunkName: "user" */ '@/views/user/Index.vue')
const UserHome = () => import(/* webpackChunkName: "user" */ '@/views/user/Home.vue')
const UserInformation = () => import(/* webpackChunkName: "user" */ '@/views/user/Information.vue')
const UserOrders = () => import(/* webpackChunkName: "user" */ '@/views/user/Orders.vue')
const UserAbout = () => import(/* webpackChunkName: "about" */ '@/views/user/About.vue')
const ChangePhone = () => import(/* webpackChunkName: "changephone" */ '@/views/user/ChangePhone.vue')
const UserOrderDetail = () => import('@/views/user/OrderDetail.vue')

/* 公益培训 */
const TrainIndex = () => import(/* webpackChunkName: "train" */ '@/views/train/Index.vue')
const TrainHome = () => import(/* webpackChunkName: "train" */ '@/views/train/Home.vue')
const TrainDetail = () => import(/* webpackChunkName: "train" */ '@/views/train/Detail.vue')

/* 体质监测 */
// const HealthyIndex = () => import(/* webpackChunkName: "healthy" */ '@/views/healthy/Index.vue')
// const HealthyMap = () => import(/* webpackChunkName: "healthy" */ '@/views/healthy/Map.vue')
// const HealthyList = () => import(/* webpackChunkName: "healthy" */ '@/views/healthy/List.vue')
// const HealthyDetail = () => import(/* webpackChunkName: "healthy" */ '@/views/healthy/Detail.vue')

/* 运动圈 */
// const SocialIndex = () => import(/* webpackChunkName: "social" */'@/views/social/Index.vue')
// const SocialList = () => import(/* webpackChunkName: "social" */'@/views/social/List.vue')
// const SocialDetial = () => import(/* webpackChunkName: "social" */'@/views/social/Detail.vue')
// const SocialPublish = () => import(/* webpackChunkName: "social" */'@/views/social/Publish.vue')

/* 体育 */
const LiveIndex = () => import('@/views/live/Index.vue')
const LiveList = () => import('@/views/live/Home.vue')
const LiveDetail = () => import('@/views/live/Detail.vue')

/* 认证 */
const Certificate = () => import('@/views/Certificate.vue')

// const Author = () => import('@/views/Author.vue')

const routes = [
  {
    path: '/',
    name: 'home',
    component: Home,
    alias: '/home',
    meta: {
      title: '运动嘉'
    }
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      title: '登录'
    }
  },
  {
    path: '/regist',
    name: 'regist',
    component: Regist,
    meta: {
      title: '注册'
    }
  },
  {
    path: '/forget',
    name: 'forget',
    component: Forget,
    meta: {
      title: '忘记密码'
    }
  },
  {
    path: '/association',
    redirect: { name: 'association-list' },
    component: AssociationIndex,
    children: [
      {
        path: 'list',
        name: 'association-list',
        meta: {
          title: '协会组织'
        },
        component: AssociationList
      },
      {
        path: 'detail/:id',
        name: 'association-detail',
        meta: {
          title: '协会详情'
        },
        component: AssociationDetail
      },
      {
        path: 'newslist/:id',
        name: 'association-news',
        meta: {
          title: '协会新闻'
        },
        component: AssociationNews
      },
      {
        path: 'newsdetail/:id',
        name: 'association-newsdetail',
        meta: {
          title: '协会新闻详情'
        },
        component: AssociationNewsDetail
      }
    ]
  },
  {
    path: '/stadium',
    redirect: { name: 'stadium-home' },
    component: StadiumIndex,
    children: [
      {
        path: 'home',
        name: 'stadium-home',
        meta: {
          title: '场馆'
        },
        component: StadiumHome
      },
      {
        path: 'list/:id',
        name: 'stadium-list',
        meta: {
          title: '场馆选择'
        },
        component: StadiumList
      },
      {
        path: 'search',
        name: 'stadium-search',
        meta: {
          title: '场馆搜索'
        },
        component: StadiumSearch
      },
      {
        path: 'detail/:id',
        name: 'stadium-detail',
        meta: {
          title: '场馆详情'
        },
        component: StadiumDetail
      },
      {
        path: 'order/:id',
        name: 'stadium-order',
        meta: {
          title: '订单详情'
        },
        component: StadiumOrder
      },
      {
        path: 'ticket/:id',
        name: 'stadium-ticket',
        meta: {
          title: '预定'
        },
        component: StadiumTicket
      },
      {
        path: 'comment',
        name: 'stadium-comment',
        meta: {
          title: '评价'
        },
        component: StadiumComment,
        props: (route) => ({
          orderId: route.query.orderId,
          sportsVenueId: route.query.sportsVenueId
        })
      }
    ]
  },
  {
    path: '/fit',
    component: FitIndex,
    redirect: { name: 'fit-map' },
    children: [
      {
        path: 'map',
        name: 'fit-map',
        meta: {
          title: '15分钟健身圈'
        },
        component: FitMap
      },
      {
        path: 'list',
        name: 'fit-list',
        meta: {
          title: '15分钟健身圈'
        },
        component: FitHome
      }
    ]
  },
  // {
  //   path: '/healthy',
  //   component: HealthyIndex,
  //   redirect: {
  //     name: 'healthy-map'
  //   },
  //   children: [
  //     {
  //       path: 'map',
  //       name: 'healthy-map',
  //       meta: {
  //         title: '体质监测'
  //       },
  //       component: HealthyMap
  //     },
  //     {
  //       path: 'list',
  //       name: 'healthy-list',
  //       meta: {
  //         title: '体质监测列表'
  //       },
  //       component: HealthyList
  //     },
  //     {
  //       path: 'detail/:id',
  //       name: 'healthy-detail',
  //       meta: {
  //         title: '体质监测'
  //       },
  //       component: HealthyDetail
  //     }
  //   ]
  // },
  {
    path: '/news',
    component: NewsIndex,
    redirect: { name: 'news-index' },
    children: [
      // {
      //   path: 'list',
      //   name: 'news-list',
      //   meta: {
      //     title: '新闻中心'
      //   },
      //   component: NewsList
      // },
      {
        path: 'detail/:id',
        name: 'news-detail',
        meta: {
          title: '新闻详情'
        },
        component: NewsDetail
      }
    ]
  },
  // {
  //   path: '/voice',
  //   component: VoiceIndex,
  //   redirect: { name: 'voice-index' },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'voice-list',
  //       meta: {
  //         title: '市民心声'
  //       },
  //       component: VoiceList
  //     },
  //     {
  //       path: 'form',
  //       name: 'voice-form',
  //       meta: {
  //         title: '我的心声'
  //       },
  //       component: VoiceForm
  //     },
  //     {
  //       path: 'detail/:id',
  //       name: 'voice-detail',
  //       meta: {
  //         title: '心声回复'
  //       },
  //       component: VoiceDetail
  //     }
  //   ]
  // },
  // {
  //   path: '/social',
  //   component: SocialIndex,
  //   redirect: {
  //     name: 'social-list'
  //   },
  //   children: [
  //     {
  //       path: 'list',
  //       name: 'social-list',
  //       meta: {
  //         title: '运动圈'
  //       },
  //       component: SocialList
  //     },
  //     {
  //       path: 'detail/:id',
  //       name: 'social-detail',
  //       meta: {
  //         title: '运动圈'
  //       },
  //       component: SocialDetial
  //     },
  //     {
  //       path: 'publish',
  //       name: 'social-publish',
  //       meta: {
  //         title: '发布'
  //       },
  //       component: SocialPublish
  //     }
  //   ]
  // },
  {
    path: '/user',
    component: UserIndex,
    redirect: { name: 'user-index' },
    children: [
      {
        path: 'home',
        name: 'user-home',
        meta: {
          title: '个人中心'
        },
        component: UserHome
      },
      {
        path: 'info',
        name: 'user-info',
        meta: {
          title: '个人信息'
        },
        component: UserInformation
      },
      {
        path: 'orders',
        name: 'user-orders',
        meta: {
          title: '我的预定'
        },
        component: UserOrders
      },
      {
        path: 'changephone',
        name: 'change-phone',
        meta: {
          title: '修改手机'
        },
        component: ChangePhone
      },
      {
        path: 'about',
        name: 'user-about',
        meta: {
          title: '关于我们'
        },
        component: UserAbout
      },
      {
        path: 'orderdetail',
        name: 'user-order-detail',
        meta: {
          title: '订单详情'
        },
        component: UserOrderDetail,
        props: (route) => ({
          orderId: route.query.orderId,
          type: route.query.type
        })
      }
    ]
  },
  {
    path: '/train',
    component: TrainIndex,
    redirect: {
      name: 'train-home'
    },
    children: [
      {
        path: 'home',
        name: 'train-home',
        meta: {
          title: '培训'
        },
        component: TrainHome
      },
      {
        path: 'detail/:id',
        name: 'train-detail',
        meta: {
          title: '培训详情'
        },
        component: TrainDetail
      }
    ]
  },
  {
    path: '/live',
    component: LiveIndex,
    redirect: 'live-list',
    children: [
      {
        path: 'list',
        name: 'live-list',
        meta: {
          title: '体育直播'
        },
        component: LiveList
      },
      {
        path: 'detail/:id',
        name: 'live-detail',
        meta: {
          title: '直播详情'
        },
        component: LiveDetail
      }
    ]
  },
  {
    path: 'certificate',
    name: 'certificate',
    component: Certificate,
    meta: {
      title: '认证'
    }
  },
  // {
  //   path: 'author',
  //   name: 'author',
  //   component: Author,
  //   meta: {
  //     title: '授权登录'
  //   }
  // },
  {
    path: '/*',
    redirect: { name: 'home' }
  }
]

export default routes
